home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1993…ch: Other People's Memory / ADC Developer CD (1993-03) (''Other People's Memory'')_iso / Dev.CD Mar 93.iso / Development Platforms / CSMP Digests / csmp-v1-034.txt < prev    next >
Encoding:
Text File  |  1992-11-18  |  50.4 KB  |  1,413 lines  |  [TEXT/MPS ]

  1. C.S.M.P. Digest             Fri, 27 Mar 92       Volume 1 : Issue 34
  2.  
  3. Today's Topics:
  4.  
  5.     serial (12-tone) matrix generator
  6.     MENU Resource ID#'s
  7.     When does StripAddress need to be used?
  8.     SetLineWidth PicComment problem
  9.     Two text fields in one window, by hand?
  10.     TextEdit:  How to Shift-Arrow-Select
  11.     ThinkC 5 and debugger crashing!
  12.     Very Large Arrays
  13.     How to find/change user name?
  14.     Newswatcher 1.0.2 bug fix
  15.  
  16.  
  17. The Comp.Sys.Mac.Programmer Digest is moderated by Michael A. Kelly.
  18.  
  19. These digests are available (by using FTP, account anonymous, your email
  20. address as password) in the pub/mac/csmp-digest directory on ftp.cs.uoregon.
  21. edu.  This is also the home of the comp.sys.mac.programmer Frequently Asked
  22. Questions list.
  23.  
  24. These digests are also available via email.  Just send a note saying that you
  25. want to be on the digest mailing list to mkelly@cs.uoregon.edu, and you will
  26. automatically receive each new digest as it is created.
  27.  
  28. The articles in these digests are taken directly from comp.sys.mac.programmer.
  29. They are not edited; all articles included in this digest are in their original
  30. posted form.  The only articles that are -not- included in these digests are
  31. those which didn't receive any replies (except those that give information
  32. rather than ask a question).  All replies to each article are concatenated
  33. onto the original article in the order in which they were received.  Article
  34. threads are not added to the digests until the last article added to the
  35. thread is at least one month old (this is to ensure that the thread is dead
  36. before adding it to the digests).
  37.  
  38. Send administrative mail to mkelly@cs.uoregon.edu.
  39.  
  40. -------------------------------------------------------
  41.  
  42. From: newton@asgaard.acc.stolaf.edu (newton)
  43. Subject: serial (12-tone) matrix generator
  44. Date: 21 Feb 92 05:28:52 GMT
  45. Organization: St. Olaf College; Northfield, MN
  46.  
  47. I am interested to know if there exists in any form, software which is
  48. capable generating, printing and manipulating 12-tone row matrices.  I
  49. am a composer and interested in developing such a music software tool
  50. myself for both analysis techniques and general compositional
  51. practice.  Because to me, it is such an obviously useful and straight
  52. forward computer music application, I intend to take on development
  53. for personal use.  However, something tells me there _must_ be someone
  54. out there who has thought of this already and I would love to hear
  55. from anyone with interest and/or results.  I would be interested in
  56. beta testing existing software, collaborating and sharing source code,
  57. ideas and speculations regarding this kind of program.
  58.  
  59. Anyone interested in following up on this, please contact me via email
  60. and I will be happily respond in kind.
  61.  
  62. thanks,
  63.  
  64. ************************************************************
  65. *Dale E. Newton           newton@stolaf.edu                *  
  66. *Blue Earth Ensemble                       *        
  67. *718 Saint Olaf Ave.      507-645-6817                     *
  68. *Northfield, MN 55057     ////////////////////////////     *  
  69. ************************************************************
  70.  
  71.  
  72.  
  73. - -------------------------
  74.  
  75. From: cc4i+@andrew.cmu.edu (Cheryl Cramer)
  76. Subject:  serial (12-tone) matrix generator
  77. Date: 26 Feb 92 17:34:57 GMT
  78. Organization: Computer Engineering Center, Carnegie Mellon, Pittsburgh, PA
  79.  
  80. Several years ago, I assisted in the development of a suite of programs
  81. to generate and manipulate 12-tone material for both composition and
  82. analysis.  These have never been formally collected into a "product" and
  83. are probably still not very well documented, but you could get more
  84. information by contacting:
  85.     Dr. John Peel
  86.     Department of Music
  87.     Box D-158
  88.     Willamette University
  89.     Salem, OR 97301
  90.  
  91.  
  92.  
  93. ---------------------------
  94.  
  95. From: wwg2101@summa.tamu.edu (GILPIN, W.W.)
  96. Subject: MENU Resource ID#'s
  97. Date: 23 Feb 92 22:05:00 GMT
  98. Organization: Texas A&M University, Academic Computing Services
  99.  
  100. Last night I was playing around with the menu ID's for my program. I changed
  101. the ID's with ResEdit by using the "Get Resource Info..." dialog. Then
  102. I changed my ID Constants in my program. Upon running my program none of my
  103. menus worked. I checked the value for MenuSelect() and it was returning the 
  104. old Menu ID's. After about an hour of fiddling I finally figured out that in
  105. order to accomplish what I wanted I had to change the ID in two different
  106. places in Resedit. Why is this? I would think that all I would have to do 
  107. is change the "Get Resource Info..." dialog, like with my window and dialog
  108. resources, but with MENU's I have to change it in the "Change ID" dialog as
  109. well. 
  110.  
  111. Wes Gilpin
  112. WWG2101@ZEUS.TAMU.EDU
  113. WWG2101@TAMZEUS
  114.  
  115.  
  116.  
  117. - -------------------------
  118.  
  119. From: dougm@descartes.cns.caltech.edu (Doug McNaught)
  120. Subject:  MENU Resource ID#'s
  121. Date: 24 Feb 92 13:21:40 GMT
  122. Organization: California Institute of Technology
  123.  
  124. In article <23FEB199217051445@summa.tamu.edu> wwg2101@summa.tamu.edu (GILPIN, W.W.) writes:
  125. >Last night I was playing around with the menu ID's for my program. I changed
  126. >the ID's with ResEdit by using the "Get Resource Info..." dialog. Then
  127. >I changed my ID Constants in my program. Upon running my program none of my
  128. >menus worked. I checked the value for MenuSelect() and it was returning the 
  129. >old Menu ID's. After about an hour of fiddling I finally figured out that in
  130. >order to accomplish what I wanted I had to change the ID in two different
  131. >places in Resedit. Why is this? I would think that all I would have to do 
  132. >is change the "Get Resource Info..." dialog, like with my window and dialog
  133. >resources, but with MENU's I have to change it in the "Change ID" dialog as
  134. >well. 
  135.  
  136.   Well, there might be a situation where you have "short" menus and "full" 
  137. menus, with the "short" being a subset. Corresponding pairs would have the same
  138. *menu* IDs but different *resource* IDs, and you could set it up so that you
  139. only need one dispatch routine for both types. The resource/menu ID wierdness
  140. is a minor annoyance, but it's the kind of thing that only bites you once, and
  141. it can be useful. 
  142. regards,
  143. doug
  144.  
  145.  
  146. -- 
  147. <><><><><><><><><><><><><><><>Go Skins!!<><><><><><><><><><><><><><><><>
  148. <> Doug McNaught                          dougm@descartes.caltech.edu <>
  149. <>  Help!!! I'm addicted to *Spaceward Ho!* Is there a support group? <>
  150. <><><><><><><><><><><><><><><>Go Skins!!<><><><><><><><><><><><><><><><>
  151.  
  152.  
  153.  
  154. - -------------------------
  155.  
  156. From: keith@Apple.COM (Keith Rollin)
  157. Subject:  MENU Resource ID#'s
  158. Date: 25 Feb 92 03:49:04 GMT
  159. Organization: Apple Computer Inc., Cupertino, CA
  160.  
  161. In article <23FEB199217051445@summa.tamu.edu> wwg2101@summa.tamu.edu (GILPIN, W.W.) writes:
  162. >Last night I was playing around with the menu ID's for my program. I changed
  163. >the ID's with ResEdit by using the "Get Resource Info..." dialog. Then
  164. >I changed my ID Constants in my program. Upon running my program none of my
  165. >menus worked. I checked the value for MenuSelect() and it was returning the 
  166. >old Menu ID's. After about an hour of fiddling I finally figured out that in
  167. >order to accomplish what I wanted I had to change the ID in two different
  168. >places in Resedit. Why is this? I would think that all I would have to do 
  169. >is change the "Get Resource Info..." dialog, like with my window and dialog
  170. >resources, but with MENU's I have to change it in the "Change ID" dialog as
  171. >well. 
  172.  
  173. Appropriately enough, the next article at my site was the summary of the
  174. Mac Programming FAQ document, which includes the topic:
  175.  
  176.       What's the difference between the resource ID of a 'MENU' resource and
  177.          the menuID field of that resource?
  178.  
  179. The summary also states the the FAQ document is "available via
  180. anonymous ftp from skinner.cs.uoregon.edu (user name 'anonymous,' your
  181. internet address as password) in the directory /pub/mac."
  182.  
  183. -- 
  184. - ----------------------------------------------------------------------------
  185. Keith Rollin           ---            <Taligent .signature under construction>
  186. Disclaimer: Pretty soon, I really _won't_ be speaking for Apple...
  187.  
  188.  
  189.  
  190. - -------------------------
  191.  
  192. From: kent@sunfs3.Camex.COM (Kent Borg)
  193. Subject:  MENU Resource ID#'s
  194. Date: 25 Feb 92 17:31:32 GMT
  195. Organization: Camex Inc., Boston MA
  196.  
  197. In article <1992Feb24.132140.13169@cco.caltech.edu> dougm@descartes.cns.caltech.edu (Doug McNaught) writes:
  198. >  Well, there might be a situation where you have "short" menus and "full" 
  199. >menus, with the "short" being a subset. Corresponding pairs would have the same
  200. >*menu* IDs but different *resource* IDs, and you could set it up so that you
  201. >only need one dispatch routine for both types. The resource/menu ID wierdness
  202. >is a minor annoyance, but it's the kind of thing that only bites you once, and
  203. >it can be useful. 
  204. >regards,
  205. >doug
  206.  
  207. No, short and full menus are evil, suitable only for folks like
  208. Microsoft.  (I like to exagerate and make enemies.)
  209.  
  210. There are, however, instances where having different sets of menus can
  211. be both useful and moral: Menus in different languages.  I recently
  212. took this approach to internationalization of an application of ours.
  213.  
  214. At launch, our application looks at the language of the system and
  215. sets a base resource number according to the language found (if we
  216. don't have a localized version of the actual language we default to
  217. English--arrogant, aren't we?).  All subsequent resource loads which
  218. need to be changed for different languages are run through a mapping
  219. function which adds the offset to the desired ID.  (Not that many
  220. affected lines, I did this as a retrofit and it only took a couple
  221. days to find and change all the resource loads, and only a few more
  222. days to correct my mistakes.  Seems pretty solid these days.)
  223.  
  224. The menu resource IDs change with different languages, but the menu
  225. IDs don't, so none of the calls to MenuSelect(), etc., needed any
  226. changes.
  227.  
  228. Now, maintaining the "source" for these resources was an interesting
  229. problem.  We use a variation on MPW's ".r" format, but with unique
  230. flags at the head of lines which are specific to a particular
  231. language.  This means that there is a single definition of, say, a
  232. DITL, with single rectangle definitions, but multiple lines for
  233. localized text, and an offset variable added to the resource ID.
  234.  
  235. We then run some scripts which preprocess this source file.  For each
  236. language, language-specific lines for other languages are stripped
  237. out, the language flag itself for this language is stripped out, and
  238. the offset variable is giving the correct definition.  These different
  239. versions are then all run through Rez.
  240.  
  241. Admittedly, this part is a bit cumbersome, but it seems to me that
  242. maintaining different language versions of resources and keeping them
  243. in sync is necessarily fairly cumbersome.  This scheme has the
  244. advantage of keeping associated resources together, which ups the odds
  245. that when the structure of one changes, the others will get matching
  246. changes.
  247.  
  248. Finally, if the user wants to run our application in a language other
  249. than the language of their system, the command key can be held down at
  250. launch and the desired language selected from a dialog.  (This
  251. feature, though not difficult to use, is obscure, but we guessed that
  252. it would be rare for someone to not want a language match.  I assume I
  253. am now going read postings and mail and explaining why it is
  254. otherwise, but that is OK, it is one of the reasons I like Usenet.)
  255.  
  256. We don't change languages on the fly as does Kid Pix, but I still I
  257. thought it was cool.
  258.  
  259. --
  260. Kent Borg                            internet: kent@camex.com   AOL: kent borg
  261.                                             H:(617) 776-6899  W:(617) 426-3577
  262. "Eating healthy beef is not healthful, the steer will take offense at you
  263. chewing on his flanks."      -me
  264.  
  265.  
  266.  
  267. ---------------------------
  268.  
  269. Subject: When does StripAddress need to be used?
  270. From: news@massey.ac.nz (USENET News System)
  271. Date: Mon, 24 Feb 1992 05:18:27 GMT
  272. Organization: School of Maths & Info. Sci., Massey University, Palmerston North, NZ
  273.  
  274. The Think Pascal manual says that StripAddress needs to be called before doing
  275. any pointer arithmetic. Is it really necessary to call it every time a handle
  276. pointer is going to be added to, or is this just referring to pointer
  277. comparison.
  278.  
  279. Brent
  280.  
  281.  
  282.  
  283. - -------------------------
  284.  
  285. From: k044477@hobbes.kzoo.edu (Jamie R. McCarthy)
  286. Subject:  When does StripAddress need to be used?
  287. Organization: Kalamazoo College
  288. Date: Mon, 24 Feb 1992 15:04:32 GMT
  289.  
  290. In article <708sis-d@massey.ac.nz> B.R.Foster@massey.ac.nz writes:
  291. >The Think Pascal manual says that StripAddress needs to be called before doing
  292. >any pointer arithmetic. Is it really necessary to call it every time a handle
  293. >pointer is going to be added to, or is this just referring to pointer
  294. >comparison.
  295.  
  296. Read Tech Note 213, which explains it quite clearly.
  297.  
  298. In 24-bit mode, you usually assume the hi byte of a master pointer
  299. contains random junk.  Normally that doesn't matter when accessing the
  300. memory it points to, because the hi byte is ignored.  But it is
  301. important when:
  302.  
  303. - You're comparing one master pointer to another.
  304. - You're going to switch the machine into 32-bit mode.
  305. - The master pointer points to a string which you're passing to
  306. OpenResFile or OpenRFPerm (OS bug).
  307. - You're calling some toolbox routines which don't expect their data
  308. to move.  I got bit because I put a SndChannel in a handle;  the sound
  309. manager stores all open channels in a linked list, and doesn't call
  310. StripAddress before it searches for your channel.  Ben Haller (I think)
  311. indicated the same thing for GrafPtrs--you don't want them to move in
  312. memory, because the system'll lost track of the linked list;  but if you
  313. put a GrafPtr in a handle, strip its address before you pass it to any
  314. toolbox calls.
  315. -- 
  316.  Jamie McCarthy     Internet: k044477@kzoo.edu     AppleLink: j.mccarthy
  317.  Kzoo randomly kills all my mail;  if I don't acknowledge, try resending.    
  318.  
  319.  
  320.  
  321. - -------------------------
  322.  
  323. From: keith@Apple.COM (Keith Rollin)
  324. Subject:  When does StripAddress need to be used?
  325. Date: 25 Feb 92 04:06:40 GMT
  326. Organization: Apple Computer Inc., Cupertino, CA
  327.  
  328. In article <708sis-d@massey.ac.nz> B.R.Foster@massey.ac.nz writes:
  329. >The Think Pascal manual says that StripAddress needs to be called before doing
  330. >any pointer arithmetic. Is it really necessary to call it every time a handle
  331. >pointer is going to be added to, or is this just referring to pointer
  332. >comparison.
  333.  
  334. Macintosh Technote #213 tries to be very clear on this. There are probably
  335. two general cases where you need to call StripAddress:
  336.  
  337. 1) If you need to do comparisons between two addresses. If you know what
  338.    you are doing, then you don't need to call StripAddress. For
  339.    instance, if the two addresses are generated from the same master
  340.    pointer and you know that the tag byte of the master pointer has not
  341.    changed, you don't need to call StripAddress.
  342.  
  343. 2) The address contains non-address bits in the upper byte, and the
  344.    address could conceivably be used in 32-bit mode.
  345.  
  346. Technote #213 gives many examples on when you should call StripAddress,
  347. and when you _don't_ need to. In the case you state above, you will
  348. probably not have to call StripAddress. For instance, the following
  349. should be OK (if I remember my Pascal OK):
  350.  
  351.     myChar := CharPtr(ORD4(myHandle^) + myOffset)^;
  352.  
  353. The only time this would _not_ be OK is if you were to execute this in
  354. 32-bit mode, and myHandle belonged to a 24-bit heap. As long as you
  355. aren't calling SwapMMUMode, or your code is not part of an interrupt
  356. routine which could be called while someone else has switched to 32-bit
  357. mode, you will be OK.
  358.  
  359. -- 
  360. - ----------------------------------------------------------------------------
  361. Keith Rollin           ---            <Taligent .signature under construction>
  362. Disclaimer: Pretty soon, I really _won't_ be speaking for Apple...
  363.  
  364.  
  365.  
  366. ---------------------------
  367.  
  368. From: maddison@husc4.harvard.edu (David Maddison)
  369. Subject: SetLineWidth PicComment problem
  370. Date: 24 Feb 92 20:42:05 GMT
  371. Organization: Harvard University Science Center
  372.  
  373. SetLineWidth problem
  374.  
  375. I have been having problems using the SetLineWidth PicComment.
  376. When I use this in accordance with TN 91 & 297. I use this Piccomment
  377. to set the linewidth to 1/4 pixel, draw the hairline, reset the
  378. linewidth to 1/1 pixel, but then ALL subsequent calls use a pen 
  379. width of 1/4 pixel!!!  
  380.  
  381. The only way I can prevent this is by inserting (after the hairline
  382. drawing) some dummy code that sets pensize to 4,4, draws a line, then resets
  383. pensize to 1,1.   Note that I am not using OpenPicture to store the
  384. picture while printing, thus the warnings in TN 297 ar------widthHdl(NewHandle(sizeOf(widthPt)));
  385.   theWidth^^.h := 4;
  386.   theWidth^^.v := 1;
  387.   PicComment(SetLineWidth, SizeOf(width make an effort to remove the effects of previous SetLineWidth}
  388. {It seems this shouldn't be necessary}
  389.   theWidth^^.h := 1;
  390.   theWidth^^.v := 1;
  391.   PicComment(SetLineWidth, SizeOf(widthPt), Handle(theWidth));
  392. {even placing another LineTo call here doesn't help}
  393.  
  394.   DisposHandle(Handle(theWidth));
  395.   PenNormal;
  396.  
  397. {the only way to make it so that following calls do not always produce}
  398. {hairlines is to enable code of the following sort:}
  399. {$IFC FALSE}
  400.   PenSize(4, 4);
  401.   MoveTo(-100, -100);
  402.   LineTo(-101, -101);
  403.   PenSize(1, 1);
  404.   MoveTo(hor, ver);
  405. {$ENDC}
  406.  
  407.  end;
  408.  
  409. {------------------------------------------------------}
  410.  procedure HairLineTest;
  411.   var
  412.    tempP: WindowPtr;
  413.    myPrPort: TPPrPort;
  414.    myStRec: TPrStatus;
  415.    db: boolean;
  416.    PgSetUp: THPrint;
  417.  begin
  418.   GetPort(tempP);
  419.   PrOpen;
  420.   if PRError = noerr then
  421.    begin
  422.     PgSetUp := THPrint(NewHandle(SizeOf(TPrint)));
  423.     PrintDefault(PgSetUp);
  424.     db := PrValidate(PgSetUp);
  425.     if PrJobDialog(PgSetUp) then
  426.      begin
  427.       myPrPort := PrOpenDoc(PgSetUp, nil, nil);
  428.       if PrError = noErr then
  429.         begin
  430.          PrOpenPage(myPrPort, nil);
  431.          if PrError = noErr then
  432.           begin
  433.            MoveTo(100, 100);
  434.            HairLineTo(100, 200);
  435.            LineTo(300, 200);   {*** why is this line a hairline too? ***}
  436.           end;
  437. cLoop = bSpoolLoop) and (PrError = noErr) then
  438.        PrPgSetUp, nil, nil, nil, myStRec);
  439.       if PrError <> noErr then
  440.        PrintErrorReport;
  441.      end;
  442.     PrClose;
  443.     DisposHandle(Handle(PgSetUp));
  444.    end
  445.   else
  446.    PrintErrorReport;
  447.   SetPort(tempP);
  448.  end;
  449.  
  450. {------  MAIN  ------}
  451. begin
  452.  HairLineTest;
  453. end.
  454.  
  455. =======
  456. David Maddison
  457. maddison@husc.harvard.edu
  458.  
  459. -- 
  460. **********************
  461. David R. Maddison
  462. Museum of Comparative Zoology
  463. Harvard University
  464.  
  465.  
  466.  
  467. - -------------------------
  468.  
  469. From: maddison@husc4.harvard.edu (David Maddison)
  470. Subject: SetLineWidth PicComment Problem (repost)
  471. Date: 24 Feb 92 21:16:40 GMT
  472. Organization: Harvard University Science Center
  473.  
  474. (sorry about problems with previous post)
  475.  
  476. I have been having problems using the SetLineWidth PicComment. When I use
  477. this in accordance with TN 91 & 297. I use this Piccomment to set the
  478. linewidth to 1/4 pixel, draw the hairline, reset the linewidth to 1/1
  479. pixel, but then ALL subsequent calls use a pen width of 1/4 pixel!!!
  480.  
  481. The only way I can prevent this is by inserting (after the hairline
  482. drawing) some dummy code that sets pensize to 4,4, draws a line, then
  483. resets pensize to 1,1.   Note that I am not using OpenPicture to store the
  484. picture while printing, thus the warnings in TN 297 are not applicable.
  485.  
  486.  
  487. Note also that when I spool to a file as per IM V, the lines are drawn
  488. appropriately, with only the lines I intend to be hairlines showing up as
  489. hairlines.  It is only when I send to the printer that things get screwed
  490. up.
  491.  
  492. (BTW, Mac IIci, 8Mb, System 7.0 with or without TuneUp, LaserWriter IINT,
  493. Think Pascal 3.02)
  494.  
  495. Below is the code for an entire little program that illustrates this
  496. behavior.
  497.  
  498.  
  499. Any help would be greatly appreciated.
  500.  
  501. Thanks!
  502.  
  503. David Maddison maddison@husc.harvard.edu
  504.  
  505. =====
  506. program HairLinesWontRecede;
  507. uses Printing;
  508.  
  509. {-----------------------------------------------------}
  510.  procedure PrintErrorReport;
  511.  begin {notify user of error}
  512.  end;
  513.  
  514. {-----------------------------------------------------}
  515.  procedure HairLineTo (hor, ver: integer);
  516.   const
  517.    SetLineWidth = 182;
  518.   type
  519.    widthHdl = ^widthPtr;
  520.    widthPtr = ^WidthPt;
  521.    widthPt = Point;
  522.   var
  523.    theWidth: widthHdl;
  524.  begin
  525.   PenNormal;
  526.   theWidth := widthHdl(NewHandle(sizeOf(widthPt)));
  527.   theWidth^^.h := 4;
  528.   theWidth^^.v := 1;
  529.   PicComment(SetLineWidth, SizeOf(widthPt), Handle(theWidth));
  530.   LineTo(hor, ver);   {draw hairline}
  531.  
  532. {now let's make an effort to remove the effects of previous SetLineWidth}
  533. {It seems this shouldn't be necessary}
  534.   theWidth^^.h := 1;
  535.   theWidth^^.v := 1;
  536.   PicComment(SetLineWidth, SizeOf(widthPt), Handle(theWidth)); {even
  537. placing another LineTo call here doesn't help}
  538.  
  539.   DisposHandle(Handle(theWidth));
  540.   PenNormal;
  541.  
  542. {the only way to make it so that following calls do not always produce}
  543. {hairlines is to enable code of the following sort:} 
  544. {$IFC FALSE}
  545.   PenSize(4, 4);
  546.   MoveTo(-100, -100);
  547.   LineTo(-101, -101);
  548.   PenSize(1, 1);
  549.   MoveTo(hor, ver); 
  550. {$ENDC}
  551.  
  552.  
  553.  end;
  554.  
  555. {------------------------------------------------------}
  556.  procedure HairLineTest;
  557.   var
  558.    tempP: WindowPtr;
  559.    myPrPort: TPPrPort;
  560.    myStRec: TPrStatus;
  561.    db: boolean;
  562.    PgSetUp: THPrint;
  563.  begin
  564.   GetPort(tempP);
  565.   PrOpen;
  566.   if PRError = noerr then
  567.    begin
  568.     PgSetUp := THPrint(NewHandle(SizeOf(TPrint)));
  569.     PrintDefault(PgSetUp);
  570.     db := PrValidate(PgSetUp);
  571.     if PrJobDialog(PgSetUp) then
  572.      begin
  573.       myPrPort := PrOpenDoc(PgSetUp, nil, nil);
  574.       if PrError = noErr then
  575.         begin
  576.          PrOpenPage(myPrPort, nil);
  577.          if PrError = noErr then
  578.           begin
  579.            MoveTo(100, 100);
  580.            HairLineTo(100, 200);
  581.            LineTo(300, 200);   {*** why is this line a hairline too? ***}
  582.           end;
  583.          PrClosePage(myPrPort);
  584.         end;
  585.       PrCloseDoc(myPrPort);
  586.       if (PgSetUp^^.prJob.bjDocLoop = bSpoolLoop) and (PrError = noErr)
  587. then
  588.        PrPicFile(PgSetUp, nil, nil, nil, myStRec);
  589.       if PrError <> noErr then
  590.        PrintErrorReport;
  591.      end;
  592.     PrClose;
  593.     DisposHandle(Handle(PgSetUp));
  594.    end
  595.   else
  596.    PrintErrorReport;
  597.   SetPort(tempP);
  598.  end;
  599.  
  600. {---- MAIN ----}
  601. begin
  602. HairLineText;
  603. end.
  604.  
  605. =====
  606. David Maddison
  607. maddison@husc.harvard.edu
  608.  
  609.  
  610. -- 
  611. **********************
  612. David R. Maddison
  613. Museum of Comparative Zoology
  614. Harvard University
  615.  
  616.  
  617.  
  618. - -------------------------
  619.  
  620. From: lim@iris.ucdavis.edu (Lloyd Lim)
  621. Subject:  SetLineWidth PicComment Problem (repost)
  622. Date: 25 Feb 92 05:44:39 GMT
  623. Organization: U.C. Davis - Department of Electrical Engineering and Computer Science
  624.  
  625. In article <1992Feb24.161642.9133@husc3.harvard.edu> maddison@husc4.harvard.edu (David Maddison) writes:
  626. >
  627. >I have been having problems using the SetLineWidth PicComment. When I use
  628. >this in accordance with TN 91 & 297. I use this Piccomment to set the
  629. >linewidth to 1/4 pixel, draw the hairline, reset the linewidth to 1/1
  630. >pixel, but then ALL subsequent calls use a pen width of 1/4 pixel!!!
  631. >
  632. >The only way I can prevent this is by inserting (after the hairline
  633. >drawing) some dummy code that sets pensize to 4,4, draws a line, then
  634. >resets pensize to 1,1.   Note that I am not using OpenPicture to store the
  635. >picture while printing, thus the warnings in TN 297 are not applicable.
  636.  
  637. I remember reading about this problem a while ago.  Some versions of the
  638. LaserWriter driver interpret the arguments absolutely: 1/4 means 1/4 of
  639. one pixel.  Some versions of the LaserWriter driver interpret the
  640. arguments relative to the last pen size: 1/4 means 1/4 of the last pen
  641. size.  I don't remember the version numbers.
  642.  
  643. How do you write code that works with both interpretations?  That's
  644. an exercise left to the reader...
  645.  
  646. No really, you had the answer.  To get back to a pen width of 1,1, you'd
  647. do two SetLineWidth calls.  The first 4,4 call works with some drivers
  648. and the second 1,1 call works with the others but doesn't screw up the
  649. results of the first.  You can get fancier to switch from one arbitrary
  650. width to another arbitrary width in two calls also.
  651.  
  652. I always thought that this would be a good question to ask in a job
  653. interview.  :-)
  654.  
  655. +++
  656. Lloyd Lim     Internet: lim@iris.cs.ucdavis.edu
  657.               America Online: LimUnltd
  658.               Compuserve: 72647,660
  659.               US Mail: 224 Lysle Leach Hall, U.C. Davis, Davis, CA 95616
  660.  
  661.  
  662.  
  663. - -------------------------
  664.  
  665. From: bradk@wimsey.bc.ca (Brad Kollmyer)
  666. Subject:  SetLineWidth PicComment Problem
  667. Date: 25 Feb 92 23:53:38 GMT
  668. Organization: Vital Consulting
  669.  
  670.  
  671. In article <1992Feb24.161642.9133@husc3.harvard.edu> (comp.sys.mac.programmer), maddison@husc4.harvard.edu (David Maddison) writes:
  672. > I have been having problems using the SetLineWidth PicComment. When I use
  673. > this in accordance with TN 91 & 297. I use this Piccomment to set the
  674. > linewidth to 1/4 pixel, draw the hairline, reset the linewidth to 1/1
  675. > pixel, but then ALL subsequent calls use a pen width of 1/4 pixel!!!
  676. > The only way I can prevent this is by inserting (after the hairline
  677. > drawing) some dummy code that sets pensize to 4,4, draws a line, then
  678. > resets pensize to 1,1.   Note that I am not using OpenPicture to store the
  679. > picture while printing, thus the warnings in TN 297 are not applicable.
  680.  
  681. The SetLineWidth PicComment multiples the previous line scaling factor
  682. when you make the call. Prior to the first call the scaling factor is 1.0.
  683. After you make a call using 1/4 you have a scalling factor or 1.0*.25=.25.
  684. After do some drawing with the desired line scaling factor you need to reset
  685. the scaling factor. To do this you need to use a  SetLineWidth PicComment
  686. using 4/1 which would result in a new scaling factor of 4.0*0.25=1.0.
  687.  
  688. To sum it all up you have to remember to undo a SetLineWidth PicComment
  689. after you are finished using a scaling factor. Hope this helps clear
  690. things up.
  691.  
  692. Brad Kollmyer.
  693. bradk@wimsey.bc.ca
  694.  
  695.  
  696.  
  697. - -------------------------
  698.  
  699. Organization: Penn State University
  700. Date: Wednesday, 26 Feb 1992 01:42:11 EST
  701. From: Christopher Tate <CXT105@psuvm.psu.edu>
  702. Subject:  SetLineWidth PicComment Problem
  703.  
  704. In article <01050017.t098h1@vitaln.wimsey.bc.ca>, bradk@wimsey.bc.ca (Brad
  705. Kollmyer) says:
  706. >
  707. >The SetLineWidth PicComment multiples the previous line scaling factor
  708. >when you make the call. Prior to the first call the scaling factor is 1.0.
  709. >After you make a call using 1/4 you have a scalling factor or 1.0*.25=.25.
  710. >After do some drawing with the desired line scaling factor you need to reset
  711. >the scaling factor. To do this you need to use a  SetLineWidth PicComment
  712. >using 4/1 which would result in a new scaling factor of 4.0*0.25=1.0.
  713.  
  714. Sadly, this is only part of the truth.  The PostScript LaserWriters do
  715. indeed behave this way, but the non-PostScript LaserWriter (such as the
  716. SC) do not.
  717.  
  718. On a Quickdraw LaserWriter, using a SetLineWidth PicComment with a
  719. scaling ratio of 4/1 *always* sets the line width to 4 points, just as
  720. using PenSize(4,4) always sets a 4-point square pen.
  721.  
  722. To get consistent results in the general case, you have to scale back to
  723. the desired size (so that the PostScript printers are reset properly),
  724. and then use a 1/1 SetLineWidth PicComment to make sure that the line
  725. width is properly set on non-PostScript devices.
  726.  
  727. Generally, here's some pseudocode for using multiple high-resolution
  728. line width definitions in sequence:
  729.  
  730.      begin
  731.         SetLineWidth(1/4);                /* divide size by 4 */
  732.         {draw stuff with 1/4 point lines}
  733.         SetLineWidth(4/1);                /* scale up by 4 */
  734.         SetLineWidth(1/1);                /* guarantee 1 point lines */
  735.  
  736.         SetLineWidth(3/8);
  737.         {draw stuff with 3/8 point lines}
  738.         SetLineWidth(8/3);
  739.         SetLineWidth(1/1);
  740.  
  741.         ...
  742.      end
  743.  
  744. And so forth.  It's *very* annoying that the behaviors are different on
  745. different output devices; why couldn't Apple have done things in a
  746. consistent way?
  747.  
  748. (And, isn't this stuff documented in Tech Note #91 or some such?  The one
  749. about optimizing LaserWriter output....)
  750.  
  751. I've heard tell that Apple really hates PicComments; I'm not sure why.
  752. If there were a more rigidly stated collection of them (like there will
  753. hopefully be for AppleEvents), they could be a very useful tool for
  754. dealing with PICT objects -- which IMHO are one of the Mac's greatest
  755. features.
  756.  
  757. - -----
  758. Christopher Tate     | Cryptogram #15:
  759. cxt105@psuvm.psu.edu |
  760. CXT105@PSUVM.BITNET  | HIPANDDZOIPOLPAU PA ZXD IDWPJPGKA NDWPDH ZXOZ
  761. - -------------------| MXDL VGK FPD, VGKI AGKW JGDA KQ ZG ZXD IGGH
  762. Send me the answer!  | OLF JDZA AZKBR.
  763.  
  764.  
  765.  
  766. - -------------------------
  767.  
  768. From: bradk@wimsey.bc.ca (Brad Kollmyer)
  769. Subject:  SetLineWidth PicComment Problem
  770. Date: 26 Feb 92 19:24:15 GMT
  771. Organization: Vital Consulting
  772.  
  773.  
  774. In article <92057.014211CXT105@psuvm.psu.edu> (comp.sys.mac.programmer), 
  775. Christopher Tate <CXT105@psuvm.psu.edu> writes:
  776. > Sadly, this is only part of the truth.  The PostScript LaserWriters do
  777. > indeed behave this way, but the non-PostScript LaserWriter (such as the
  778. > SC) do not.
  779.  
  780. If the printer even supports the PicComment. I know that GDT's
  781. JetLink Express, which I wrote, supports comments like the
  782. LaserWriter driver.
  783.  
  784. > Generally, here's some pseudocode for using multiple high-resolution
  785. > line width definitions in sequence:
  786. >      begin
  787. >         SetLineWidth(1/4);                /* divide size by 4 */
  788. >         {draw stuff with 1/4 point lines}
  789. >         SetLineWidth(4/1);                /* scale up by 4 */
  790. >         SetLineWidth(1/1);                /* guarantee 1 point lines */
  791. >         SetLineWidth(3/8);
  792. >         {draw stuff with 3/8 point lines}
  793. >         SetLineWidth(8/3);
  794. >         SetLineWidth(1/1);
  795. >         ...
  796. >      end
  797.  
  798. This would work for all printer even those QuickDraw printers that
  799. have not implemented the PicComment like the LaserWriter driver.
  800.  
  801. Brad Kollmyer.
  802. bradk@wimsey.bc.ca
  803.  
  804.  
  805.  
  806. ---------------------------
  807.  
  808. From: robertj@Autodesk.COM (Young Rob Jellinghaus)
  809. Subject: Two text fields in one window, by hand?
  810. Date: 21 Feb 92 20:05:50 GMT
  811. Organization: Autodesk Inc., Sausalito CA, USA
  812.  
  813. Oh, what a simple question this is!
  814.  
  815. For some reason I want to implement a window with two TextEdit fields
  816. in it--sorta like a dialog box, but I don't want to use the Dialog
  817. Manager.
  818.  
  819. Now, I know how to make the window and create the TextEdit rects and
  820. all that.  But the question has to do with activating and deactivating
  821. them:  let's say field 1 is active, and the user clicks in field 2.
  822. Do I need to _first_ call TEActivate on field 2, and TEDeactivate on
  823. field 1, and _then_ call TEClick with the event?  That is, does a
  824. TextEdit field need to be activated before I can call TEClick on it?
  825.  
  826. Inside Mac vol. 1, and Chernicoff vol. 2, both seem to assume that
  827. no one would ever want to put more than one TextEdit field in a window--
  828. or that if they did they'd use the Dialog Manager.  Anyone out there
  829. know the answer to this simple little question?  It'd be a bonus if
  830. you could point me at a good book that answers questions like this.
  831.  
  832. --
  833. Rob Jellinghaus                | "Next time you see a lie being spread or
  834. Autodesk, Inc.                 |  a bad decision being made out of sheer
  835. Internet: robertj@Autodesk.COM |  ignorance, pause, and think of hypertext."
  836. AMIX: RJELLINGHAUS             |    -- K. Eric Drexler, _Engines of Creation_
  837.  
  838.  
  839.  
  840. - -------------------------
  841.  
  842. From: dorner@pequod.cso.uiuc.edu (Steve Dorner)
  843. Subject:  Two text fields in one window, by hand?
  844. Date: 25 Feb 92 20:43:19 GMT
  845. Organization: University of Illinois at Urbana-Champaign
  846.  
  847. robertj@Autodesk.COM (Young Rob Jellinghaus) writes:
  848. >That is, does a
  849. >TextEdit field need to be activated before I can call TEClick on it?
  850.  
  851. You would not lose your bippy if you were to bet it on this.
  852.  
  853. >Do I need to _first_ call TEActivate on field 2, and TEDeactivate on
  854. >field 1, and _then_ call TEClick with the event?
  855.  
  856. I deactivate field 1 first, then activate field 2, then call TESomething.
  857.  
  858. NB - There's no reason in TE that you would have to Deactivate the fields
  859. at all.  If you have some strange mutant interface where you want simultaneous
  860. selections in multiple panes, I'm pretty sure TE will tolerate it.  (Your
  861. users and the ATP are a whole different story, of course.)
  862. -- 
  863. Steve Dorner, U of Illinois Computing Services Office
  864. Internet: s-dorner@uiuc.edu  UUCP: uunet!uiucuxc!uiuc.edu!s-dorner
  865.  
  866.  
  867.  
  868. ---------------------------
  869.  
  870. From: brunner@brchh87.bnr.ca (James Brunner)
  871. Subject: TextEdit:  How to Shift-Arrow-Select
  872. Date: 25 Feb 92 15:11:43 GMT
  873.  
  874. After reading some of Inside Macintosh IV, I have a question.  Chapter #1
  875. gives interface guidelines and explains how to select text with the
  876. shift-arrow combinations.  The chapter on TextEdit states in the first
  877. section that if using system version 3 or better, TextEdit will AUTOMATICALLY
  878. handle selection via the shift-arrow keys.  How?  I would expect something
  879. like this to have to be done via the "TEKey" routine.  However, this routine
  880. is only passed a CHAR and the TEHandle.  The character generated by a
  881. shift-arrow is the same as the character generated by the arrow alone.  Only
  882. the modifiers are different - they are not passed.
  883.  
  884. How does TextEdit do it?  Does it inspect for the shift key being pressed
  885. when the routine is called?  This could be some time after the actual
  886. keyboard event.  Maybe there never was a keyboard event.
  887.  
  888. What's the scoop?
  889. -- 
  890. - -------------------------------------------------------------------------
  891. Jim Brunner - (brunner@brchh87.BNR.CA)
  892. All opinions are my own and have nothing whatsoever to do with BNR, NT,
  893. NTI, Bell Canada, or any of the BCE corporations or affiliates.
  894.  
  895.  
  896.  
  897. - -------------------------
  898.  
  899. From: d88-jwa@hemul.nada.kth.se (Jon W{tte)
  900. Subject:  TextEdit:  How to Shift-Arrow-Select
  901. Date: 25 Feb 92 22:43:36 GMT
  902. Organization: Royal Institute of Technology, Stockholm, Sweden
  903.  
  904. > brunner@brchh87.bnr.ca (James Brunner) writes:
  905.  
  906.    shift-arrow combinations.  The chapter on TextEdit states in the first
  907.    section that if using system version 3 or better, TextEdit will AUTOMATICALLY
  908.    handle selection via the shift-arrow keys.  How?  I would expect something
  909.  
  910. It doesn't. You have to. Luckily, it isn't too hard, getting the selection,
  911. switching on the key and then setting the selection again.
  912.  
  913. --
  914. This Signature is distributed under the conditions of the Signature License,
  915. available at a fee from   h+@nada.kth.se  (Jon W{tte)  Reading the Signature
  916. implies that you accept to be bound by the terms in said License. Should you
  917. not agree on any of these terms, you must return the Signature unread to me.
  918.  
  919.  
  920.  
  921. ---------------------------
  922.  
  923. From: ummorea0@ccu.umanitoba.ca (Gene Moreau)
  924. Subject: ThinkC 5 and debugger crashing!
  925. Organization: University of Manitoba, Winnipeg, Manitoba, Canada
  926. Date: Tue, 25 Feb 1992 18:35:45 GMT
  927.  
  928. I seem to be having a problem with ThinC 5.02, mabey some one out there can help
  929. me.  I am trying to write a mac shell, you know, windows, menu, etc...
  930. It seem to be working fine when I run with the debugger turned on, but when I
  931. turn off the debugger it hangs the whole computer and doesn't do any of the
  932. window updates properly.  If I build it as an application then it does the 
  933. same thing and doesn't add it's name to the application menu and also hangs
  934. the entire computer.  Am I missing something??  I am calling all the init
  935. routines that inside mac gives in there example in IM I (all the one for the 
  936. managers that I am using, all of them that I can think of actully).
  937. Just what am I doing wrong???  
  938. -- 
  939. Gene Moreau, University of Manitoba, ummorea0@ccu.umanitoba.ca
  940. - ------------------------------------------------------------
  941. "Hold up a one iron and walk.  Even God can't hit a one iron"
  942.   -Lee Traveno, on how to not get struck by lightning.
  943.  
  944.  
  945.  
  946. - -------------------------
  947.  
  948. From: jxs18@po.CWRU.Edu (Jerry Sy)
  949. Subject:  ThinkC 5 and debugger crashing!
  950. Date: 25 Feb 92 20:55:07 GMT
  951. Organization: Case Western Reserve University, Cleveland, OH (USA)
  952.  
  953.  
  954. In a previous article, ummorea0@ccu.umanitoba.ca (Gene Moreau) says:
  955.  
  956. >I seem to be having a problem with ThinC 5.02, mabey some one out there can help
  957. >me.  I am trying to write a mac shell, you know, windows, menu, etc...
  958. >It seem to be working fine when I run with the debugger turned on, but when I
  959. >turn off the debugger it hangs the whole computer and doesn't do any of the
  960. >window updates properly.  If I build it as an application then it does the 
  961. >same thing and doesn't add it's name to the application menu and also hangs
  962. >the entire computer.  Am I missing something??  I am calling all the init
  963. >routines that inside mac gives in there example in IM I (all the one for the 
  964. >managers that I am using, all of them that I can think of actully).
  965. >Just what am I doing wrong???  
  966. >-- 
  967.  
  968. Yes you are missing something.  The debugger initializes the toolbox
  969. you are using for you, which your program probably did not.
  970.  
  971. check out which toolbox routines you are using, e.g. windows, controls,
  972. etc and do initalize them at the start of your program (i.e. InitWindows(),
  973. InitGraf(&thePort), InitCursor(), etc) and your program should be working
  974. fine.
  975.  
  976. jerry sy
  977.  
  978.  
  979.  
  980. ---------------------------
  981.  
  982. From: tarr-michael@CS.YALE.EDU (Michael J. Tarr)
  983. Subject: Very Large Arrays
  984. Organization: Department of Psychology, Yale University
  985. Date: Tue, 25 Feb 1992 19:26:46 GMT
  986.  
  987.  
  988. I have been trying to run a program in THINK C 5.0.2 with a very large
  989. array. THe system is a Quadra 700 w/ 20MB RAM.
  990.  
  991. Here is the pertinent code:
  992.  
  993.     int NumSols[1],n,p,i,j;
  994.     FILE *fp;
  995.     double x[LEN][M][2],ans[LEN][M][2];
  996.  
  997.     if ((fp=fopen("points.init","r"))== NULL) {
  998.         perror("Cannot find the file 'points.init'!");
  999.         NumSols[0] = -1; }
  1000.  
  1001.  
  1002.     fscanf(fp,"%d %d",&n,&p);
  1003.     for(i=0;i<n;i++)
  1004.         for(j=0;j<p;j++)
  1005.         fscanf(fp,"%lf %lf",&x[i][j][REAL],&x[i][j][COMPLEX]);
  1006.    
  1007.     if(fclose(fp)) {
  1008.         perror("ERROR in closing the DATA file");
  1009.         NumSols[0] = -1;
  1010.     }
  1011.  
  1012.  
  1013. When LEN = 16 it runs fine, but when LEN = 16000 it bombs on the fscanf.
  1014. I have both code and data far options checked...
  1015.  
  1016. How do I get this to run?
  1017.  
  1018. Please reply directly!
  1019.  
  1020. Mike Tarr
  1021. tarr@cs.yale.edu
  1022.  
  1023.  
  1024.  
  1025. - -------------------------
  1026.  
  1027. From: d88-jwa@hemul.nada.kth.se (Jon W{tte)
  1028. Subject:  Very Large Arrays
  1029. Date: 26 Feb 92 10:36:17 GMT
  1030. Organization: Royal Institute of Technology, Stockholm, Sweden
  1031.  
  1032. .yale.edu> tarr-michael@CS.YALE.EDU (Michael J. Tarr) writes:
  1033.  
  1034.    Here is the pertinent code:
  1035.  
  1036.        int NumSols[1],n,p,i,j;
  1037.        FILE *fp;
  1038.        double x[LEN][M][2],ans[LEN][M][2];
  1039.  
  1040. First, the stack in a mac is never guaranteed to be more than 8K (!)
  1041. unless you foribly increase it. On color QD machines, it's at least 24K
  1042. though.
  1043.  
  1044. Second, compile-time-sized arrays or structs may NOT be larger than
  1045. 32k; you have to allocate those run-time (using NewPtr or NewHandle
  1046. or just plain malloc)
  1047.  
  1048.    When LEN = 16 it runs fine, but when LEN = 16000 it bombs on the fscanf.
  1049.    I have both code and data far options checked...
  1050.  
  1051. Hope this helps !
  1052.  
  1053. --
  1054. This Signature is distributed under the conditions of the Signature License,
  1055. available at a fee from   h+@nada.kth.se  (Jon W{tte)  Reading the Signature
  1056. implies that you accept to be bound by the terms in said License. Should you
  1057. not agree on any of these terms, you must return the Signature unread to me.
  1058.  
  1059.  
  1060.  
  1061. ---------------------------
  1062.  
  1063. From: blimoges@sobeco.com (Bertrand Limoges)
  1064. Subject: How to find/change user name?
  1065. Date: 25 Feb 92 20:04:41 GMT
  1066. Organization: Sobeco Ernst & Young Inc.
  1067.  
  1068. I want to bring up the user name displayed in the Chooser in my
  1069. own dialog, and possibly change it from my application. I know
  1070. this is probably a no-no, but the name needs to change often and
  1071. I want to save the user having to bring up the Chooser every time.
  1072. Regardless, displaying the current Chooser name is a must, and I
  1073. can't seem to find any info in IM on the subject.
  1074.  
  1075. Any help much appreciated, you can email directly, Bertrand
  1076.  
  1077.  
  1078.  
  1079. - -------------------------
  1080.  
  1081. From: L.Nicholas.Brosnahan.Jr@dartmouth.edu (L. Nicholas Brosnahan Jr)
  1082. Subject:  How to find/change user name?
  1083. Date: 26 Feb 92 00:32:04 GMT
  1084. Organization: Dartmouth College, Hanover, NH
  1085.  
  1086. In article <1992Feb25.200441.21587@sobeco.com>
  1087. blimoges@sobeco.com (Bertrand Limoges) writes:
  1088.  
  1089. This is what you do:
  1090.      chooserNameH = GetString(-16096);
  1091.  
  1092. Look in IM I for GetString.
  1093.  
  1094. > I want to bring up the user name displayed in the Chooser in my
  1095. > own dialog, and possibly change it from my application. I know
  1096. > this is probably a no-no, but the name needs to change often and
  1097. > I want to save the user having to bring up the Chooser every time.
  1098. > Regardless, displaying the current Chooser name is a must, and I
  1099. > can't seem to find any info in IM on the subject.
  1100. > Any help much appreciated, you can email directly, Bertrand
  1101.  
  1102.  
  1103.  
  1104. ---------------------------
  1105.  
  1106. From: huff@mcclb0.med.nyu.edu (Edward J. Huff)
  1107. Subject: Newswatcher 1.0.2 bug fix
  1108. Date: 25 Feb 92 19:59:10 GMT
  1109. Organization: NYU Chemistry Dept
  1110.  
  1111. Newswatcher is one of three Mac newsreaders which I know of.  It is free and
  1112. comes with source.  It was written by Steven Falkenburg, sfalken@apple.com
  1113. It is widely available from ftp sites.  So far as I know, the latest version
  1114. is 1.0.2.
  1115.  
  1116. This version has a problem when the main newsgroups window contains a large
  1117. number of groups.  I made a quick fix today (use two newsgroups windows)
  1118. and am posting the details to comp.sys.mac.programmer.
  1119.  
  1120. This problem was reported by jim@cavebear.berkeley.edu (Jim Bradley) and by
  1121. ds11129@basil.psg.medtronic.com (Dean R. Schrimpf).
  1122.  
  1123. Comparing the original source to my modified files gives the following
  1124. differences.  (I also added a missing return to GrowDataStructure() and
  1125. changed the percent complete calculation for "Getting groups from net"
  1126. to assume a maximum of 2000 groups instead of 1100, and why use float
  1127. when long will do?)
  1128.  
  1129. This was compiled under MPW 3.1.  I had to comment out include <Printing.h>
  1130. a few places to get it to compile before making any changes.
  1131.  
  1132. backup -r -compare only -to :orig: -from :
  1133. Compare :source:commands.c :orig:source:commands.c 
  1134.  
  1135. File #1: :source:commands.c
  1136. File #2: :orig:source:commands.c
  1137.  
  1138. Extra lines in 1st before 7 in 2nd (File ":source:commands.c"; Line 7; File ":orig:source:commands.c"; Line F7)
  1139.    7    #   Modified for two Newsgroups windows 2/25/92 Edward J. Huff
  1140.  
  1141.  
  1142. Nonmatching lines (File ":source:commands.c"; Line 42; File ":orig:source:commands.c"; Line 41)
  1143.   42    /*#include <Printing.h> removed 2/25/92 EJH */
  1144.  
  1145.   41    #include <Printing.h>
  1146.  
  1147.  
  1148. Extra lines in 1st before 109 in 2nd (File ":source:commands.c"; Line 110; File ":orig:source:commands.c"; Line F109)
  1149.  110        (Sorting is done by the caller EJH 2/25/92)
  1150.  
  1151.  
  1152. Nonmatching lines (File ":source:commands.c"; Line 119; File ":orig:source:commands.c"; Line 117:120)
  1153.  119            
  1154.  
  1155.  117        
  1156.  118        StatusWindow("Sorting Groups...",-1);
  1157.  119        qsort(groupList, numGroups, sizeof(TGroup), MyCompare);
  1158.  120        
  1159.  
  1160.  
  1161. Extra lines in 2nd before 147 in 1st (File ":source:commands.c"; Line F147; File ":orig:source:commands.c"; Line 148:159)
  1162.  148    /*  MyCompare is a comparison routine used in the call to
  1163.  149        qsort() above.  It does a simple string compare, and
  1164.  150        gives time to background applications.
  1165.  151    */
  1166.  152    
  1167.  153    int MyCompare(TGroup *one,TGroup *two)
  1168.  154    {
  1169.  155        GiveTime(0);
  1170.  156        return strcmp(one->name,two->name);
  1171.  157    }
  1172.  158    
  1173.  159    
  1174.  
  1175.  
  1176. *** EOF on both files at the same time ***
  1177. Compare :source:nntplow.c :orig:source:nntplow.c 
  1178.  
  1179. File #1: :source:nntplow.c
  1180. File #2: :orig:source:nntplow.c
  1181.  
  1182. Extra lines in 1st before 77 in 2nd (File ":source:nntplow.c"; Line 77; File ":orig:source:nntplow.c"; Line F77)
  1183.   77        return noErr;
  1184.  
  1185.  
  1186. Nonmatching lines (File ":source:nntplow.c"; Line 269; File ":orig:source:nntplow.c"; Line 268)
  1187.  269                                StatusWindow("Getting Groups From Net...",(short)(1+(((long)*numGroups)*100/2000)));
  1188.  
  1189.  268                                StatusWindow("Getting Groups From Net...",(short)1+(((float)(*numGroups)/1100.0)*100));
  1190.  
  1191.  
  1192. *** EOF on both files at the same time ***
  1193. Compare :source:printstuff.c :orig:source:printstuff.c 
  1194.  
  1195. File #1: :source:printstuff.c
  1196. File #2: :orig:source:printstuff.c
  1197.  
  1198. Nonmatching lines (File ":source:printstuff.c"; Line 25; File ":orig:source:printstuff.c"; Line 25)
  1199.   25    /*#include <Printing.h> removed 2/25/92 EJH */
  1200.  
  1201.   25    #include <Printing.h>
  1202.  
  1203.  
  1204. *** EOF on both files at the same time ***
  1205. Compare :source:userint.c :orig:source:userint.c 
  1206.  
  1207. File #1: :source:userint.c
  1208. File #2: :orig:source:userint.c
  1209.  
  1210. Extra lines in 1st before 7 in 2nd (File ":source:userint.c"; Line 7; File ":orig:source:userint.c"; Line F7)
  1211.    7    #   Modified for two Newsgroups windows 2/25/92 Edward J. Huff
  1212.  
  1213.  
  1214. Nonmatching lines (File ":source:userint.c"; Line 43; File ":orig:source:userint.c"; Line 42)
  1215.   43    /*#include <Printing.h> removed 2/25/92 EJH */
  1216.  
  1217.   42    #include <Printing.h>
  1218.  
  1219.  
  1220. Nonmatching lines (File ":source:userint.c"; Line 90:91; File ":orig:source:userint.c"; Line 89)
  1221.   90    static  WindowPtr   gGroupWindowA;
  1222.   91    static  WindowPtr   gGroupWindowB;
  1223.  
  1224.   89    static  WindowPtr   gGroupWindow;
  1225.  
  1226.  
  1227. Nonmatching lines (File ":source:userint.c"; Line 193:214; File ":orig:source:userint.c"; Line 191:197)
  1228.  193    /*  MyCompare is a comparison routine used in the call to
  1229.  194        qsort() below.  It does a simple string compare, and
  1230.  195        gives time to background applications.
  1231.  196    */
  1232.  197    
  1233.  198    static int MyCompare(TGroup *one,TGroup *two)
  1234.  199    {
  1235.  200        GiveTime(0);
  1236.  201        return strcmp(one->name,two->name);
  1237.  202    }
  1238.  203    
  1239.  204    /* SetUpWindows: creates an initial, empty window */
  1240.  205    /* Modified for two Newsgroups windows 2/25/92 EJH */
  1241.  206    
  1242.  207    void SetUpWindows(void)
  1243.  208    {
  1244.  209        WindowPtr theWind;
  1245.  210        WindowPtr theWindA;
  1246.  211        WindowPtr theWindB;
  1247.  212        TwindowInfo *theInfo;
  1248.  213        TwindowInfo *theInfoA;
  1249.  214        TwindowInfo *theInfoB;
  1250.  
  1251.  191    
  1252.  192    /* SetUpWindows: creates an initial, empty window */
  1253.  193    
  1254.  194    void SetUpWindows(void)
  1255.  195    {
  1256.  196        WindowPtr theWind;
  1257.  197        TwindowInfo *theInfo;
  1258.  
  1259.  
  1260. Nonmatching lines (File ":source:userint.c"; Line 222:273; File ":orig:source:userint.c"; Line 205:239)
  1261.  222        gGroupWindowA = theWindA = MakeNewWindow(cGroup,false,firstOffset,"\pNewsgroupsA");
  1262.  223        gGroupWindowB = theWindB = MakeNewWindow(cGroup,false,firstOffset,"\pNewsgroupsB");
  1263.  224        theInfoA = (TwindowInfo *) GetWRefCon(gGroupWindowA);
  1264.  225        theInfoB = (TwindowInfo *) GetWRefCon(gGroupWindowB);
  1265.  226    
  1266.  227        StatusWindow("Sorting Groups...",-1);
  1267.  228        qsort(gGroupList, gNumGroups, sizeof(TGroup), MyCompare);
  1268.  229        
  1269.  230        theInfoA->numGroups = gNumGroups / 2;
  1270.  231        theInfoA->data2 = (unsigned long) gGroupList;
  1271.  232        theInfoB->numGroups = gNumGroups - theInfoA->numGroups;
  1272.  233        theInfoB->data2 = (unsigned long) (&gGroupList[theInfoA->numGroups]);
  1273.  234        
  1274.  235        for (theInfo = theInfoA, theWind = theWindA; theInfo != nil; ) {
  1275.  236            theInfo->parentGroup = nil;
  1276.  237            theInfo->parentWindow = nil;
  1277.  238            theInfo->childList = nil;
  1278.  239            
  1279.  240            MakeGroupList((ListHandle)theInfo->data,theInfo->numGroups,(TGroup *)theInfo->data2);
  1280.  241            SetPt(&thePt,0,0);
  1281.  242            LSetSelect(true,thePt,(ListHandle)theInfo->data);
  1282.  243            
  1283.  244            GetPort(&savePort);
  1284.  245            SetPort(theWind);
  1285.  246        
  1286.  247            SizeWindow(theWind,gPrefs.groupWindowSize.right-gPrefs.groupWindowSize.left,
  1287.  248                            gPrefs.groupWindowSize.bottom-gPrefs.groupWindowSize.top,true);
  1288.  249            SizeContents(gPrefs.groupWindowSize.right-gPrefs.groupWindowSize.left,
  1289.  250                            gPrefs.groupWindowSize.bottom-gPrefs.groupWindowSize.top,theWind);
  1290.  251            MoveWindow(theWind,gPrefs.groupWindowSize.left,gPrefs.groupWindowSize.top,false);
  1291.  252        
  1292.  253            CloseStatusWindow();
  1293.  254            if (gPrefs.openWindowsZoomed)
  1294.  255                DoZoom(theWind,inZoomOut);
  1295.  256        
  1296.  257            if (!gPrefs.groupWindowVisible) {
  1297.  258                HideWindow(theWind);
  1298.  259                RemoveWindowsMenu(theWind);
  1299.  260                SetItem(gTheMenu[kWindowsMenu],kHideShowWind,kShowText);
  1300.  261            }
  1301.  262            else
  1302.  263                ShowWindow(theWind);
  1303.  264        
  1304.  265            InvalRect(&theWind->portRect);
  1305.  266            SetPort(savePort);
  1306.  267            if (theInfo == theInfoA) {
  1307.  268                theInfo = theInfoB;
  1308.  269                theWind = theWindB;
  1309.  270            }
  1310.  271            else
  1311.  272                theInfo = nil;
  1312.  273        }
  1313.  
  1314.  205        theInfo = (TwindowInfo *) GetWRefCon(gGroupWindow = theWind = MakeNewWindow(cGroup,false,firstOffset,"\pNewsgroups"));
  1315.  206    
  1316.  207        theInfo->numGroups = gNumGroups;
  1317.  208        theInfo->data2 = (unsigned long) gGroupList;
  1318.  209        theInfo->parentGroup = nil;
  1319.  210        theInfo->parentWindow = nil;
  1320.  211        theInfo->childList = nil;
  1321.  212        
  1322.  213        MakeGroupList((ListHandle)theInfo->data,gNumGroups,gGroupList);
  1323.  214        SetPt(&thePt,0,0);
  1324.  215        LSetSelect(true,thePt,(ListHandle)theInfo->data);
  1325.  216        
  1326.  217        GetPort(&savePort);
  1327.  218        SetPort(theWind);
  1328.  219    
  1329.  220        SizeWindow(theWind,gPrefs.groupWindowSize.right-gPrefs.groupWindowSize.left,
  1330.  221                        gPrefs.groupWindowSize.bottom-gPrefs.groupWindowSize.top,true);
  1331.  222        SizeContents(gPrefs.groupWindowSize.right-gPrefs.groupWindowSize.left,
  1332.  223                        gPrefs.groupWindowSize.bottom-gPrefs.groupWindowSize.top,theWind);
  1333.  224        MoveWindow(theWind,gPrefs.groupWindowSize.left,gPrefs.groupWindowSize.top,false);
  1334.  225    
  1335.  226        CloseStatusWindow();
  1336.  227        if (gPrefs.openWindowsZoomed)
  1337.  228            DoZoom(theWind,inZoomOut);
  1338.  229    
  1339.  230        if (!gPrefs.groupWindowVisible) {
  1340.  231            gPrefs.groupWindowVisible = !gPrefs.groupWindowVisible;
  1341.  232            HideShowGroups();
  1342.  233        }
  1343.  234        else
  1344.  235            ShowWindow(theWind);
  1345.  236    
  1346.  237        InvalRect(&theWind->portRect);
  1347.  238        SetPort(savePort);
  1348.  239        
  1349.  
  1350.  
  1351. Nonmatching lines (File ":source:userint.c"; Line 2238:2241; File ":orig:source:userint.c"; Line 2204:2205)
  1352. 2238            HideWindow(gGroupWindowA);
  1353. 2239            RemoveWindowsMenu(gGroupWindowA);
  1354. 2240            HideWindow(gGroupWindowB);
  1355. 2241            RemoveWindowsMenu(gGroupWindowB);
  1356.  
  1357. 2204            HideWindow(gGroupWindow);
  1358. 2205            RemoveWindowsMenu(gGroupWindow);
  1359.  
  1360.  
  1361. Nonmatching lines (File ":source:userint.c"; Line 2245:2248; File ":orig:source:userint.c"; Line 2209:2210)
  1362. 2245            ShowWindow(gGroupWindowA);
  1363. 2246            AddWindowsMenu(gGroupWindowA);
  1364. 2247            ShowWindow(gGroupWindowB);
  1365. 2248            AddWindowsMenu(gGroupWindowB);
  1366.  
  1367. 2209            ShowWindow(gGroupWindow);
  1368. 2210            AddWindowsMenu(gGroupWindow);
  1369.  
  1370.  
  1371. *** EOF on both files at the same time ***
  1372.  
  1373.  
  1374.  
  1375. - -------------------------
  1376.  
  1377. From: huff@mcclb0.med.nyu.edu (Edward J. Huff)
  1378. Subject:  Newswatcher 1.0.2 bug fix
  1379. Date: 25 Feb 92 21:14:05 GMT
  1380. Organization: NYU Chemistry Dept
  1381.  
  1382. In article <1992Feb25.195910.17163@cmcl2.nyu.edu>, huff@mcclb0.med.nyu.edu (Edward J. Huff) writes:
  1383. > Newswatcher is one of three Mac newsreaders which I know of.  It is free and
  1384. > comes with source.  It was written by Steven Falkenburg, sfalken@apple.com
  1385. > It is widely available from ftp sites.  So far as I know, the latest version
  1386. > is 1.0.2.
  1387. > This version has a problem when the main newsgroups window contains a large
  1388. > number of groups.  I made a quick fix today (use two newsgroups windows)
  1389. > and am posting the details to comp.sys.mac.programmer.
  1390.  
  1391. Use the modified version at your own risk.  I got a crash upon quit which
  1392. I have not been able to reproduce.  It probably has to do with some place
  1393. where the program "knows" that there is only one main newsgroups window.
  1394.  
  1395. The crash was in _InvalRect called from GetWRefCon called from DoCloseWindow
  1396. called from DoQuitStuff, or something like that.
  1397.  
  1398.  
  1399.  
  1400. ---------------------------
  1401.  
  1402. End of C.S.M.P. Digest
  1403. **********************
  1404.